﻿--提取审批列表
CREATE proc [dbo].[proc_Employee_CompanyMove_GetAuditList_Count]
(
	@ename nvarchar(50),
	@companyid nvarchar(4),
	@audit nvarchar(4)
)
as

		Select Count(Id)
			From Employee_CompanyMove EC 
		Where (@CompanyId=0 Or (select companyid from employee E where EC.EId=E.Id)=@CompanyId) And (@EName is null Or (select EName from Employee E where EC.EId=E.Id) like '%'+ @EName +'%') 
					and (case when EC.audit=1 then '1' 
						when EC.audit=0 and EC.auditperson is null then '0'
						when EC.audit=0 and EC.auditperson is not null then '1' end) like '%'+@audit+'%'
					and EC.Proposer is not null
RETURN